package com.jframework.module.usps.beans.rates;

import java.util.ArrayList;
import java.util.List;

import com.jframework.module.usps.beans.Package;
import com.jframework.module.usps.beans.ResponseError;

public class RateV3ResponsePackage 
       extends RateV3RequestPackage
       implements Package 
{   
    private String Zone = null;
    private ResponseError error = null;
    private List list 	= null;
    
    public RateV3Postage[] getPostage()
    {
	if (null == this.list) return null;
	RateV3Postage[] packageArray = new RateV3Postage[list.size()];
        return (RateV3Postage[]) list.toArray(packageArray);
    }

    
    public boolean addPostage(RateV3Postage aPostage)
    {
	if (null == this.list) this.list = new ArrayList();
        if (!list.contains(aPostage))
	  return list.add(aPostage);
        
        return false;
    }
    
    public void setPostage(RateV3Postage[] postages)
    {
        if (null != postages)        
         for (int i=0; i < postages.length; i++)
         {
            this.addPostage(postages[i]);
         }
    }
    
    

    /**
     * @return the zone
     */
    public String getZone() {
        return Zone;
    }
    /**
     * @param zone the zone to set
     */
    public void setZone(String zone) {
        Zone = zone;
    }


    /**
     * @return the error
     */
    public ResponseError getError() {
        return error;
    }


    /**
     * @param error the error to set
     */
    public void setError(ResponseError error) {
        this.error = error;
    }
}
